package com.digitalchina.dcn.dcss.portal.client;

import com.digitalchina.dcn.dcss.portal.util.PortalContext;
import org.springframework.web.context.request.async.DeferredResult;
import org.springframework.web.servlet.ModelAndView;

import java.net.InetSocketAddress;

/**
 * Portal Server和AC一次认证过程的唯一标识
 *
 * Created by Administrator on 2016/8/23 0023.
 */
public class AuthInfo {

    public final long startTime = System.currentTimeMillis();

    public final String userName;
    public final String password;
    /**
     * Portal Server生成的SN号
     */
    public final int serialNo;
    /**
     * AC生成的 reqID;
     */
    public int reqID;
    /** true : 认证请求流程<br/>
     *  false: 下线请求流程
     *  */
    public boolean isAuth = true;
    public boolean isSuccessful = false;
    public DeferredResult<ModelAndView> result;
    /** 用户接入网络的AC IP地址 */
    public final InetSocketAddress acAddress;

    public AuthInfo(String acip, String userName, String password, int serialNo) {
        acAddress = new InetSocketAddress(acip, PortalContext.AC_PORT);
        this.password = password;
        this.userName = userName;
        this.serialNo = serialNo;
    }
}
